package com.ldb.Controller.service;

import java.util.List;

import com.ldb.Controller.dao.MessagesDao;
import com.ldb.Controller.dao.PageResults;
import com.ldb.Controller.entity.Messages;
import com.ldb.Controller.entity.Student;

public class MessagesManager {

	private MessagesDao messageDao;
	
	public void setMessagesDao(MessagesDao messageDao) {
		this.messageDao = messageDao;
	}
	
	public MessagesDao getMessagesDao() {
		return this.messageDao;
	}
	
	public void addAMessage(Messages messages) {
		this.messageDao.addEntity(messages);
	}
	
	public void deleteAMessage(String id) {
		this.messageDao.setClazz(Messages.class);
		this.messageDao.deleteEntity(Messages.class,id);
	}
	
	public List<Messages> getAllMessages(){
		this.messageDao.setClazz(Messages.class);
		return this.messageDao.getEntityAll();
	}
	
	public List<Messages> getAllMessagesDesc(){
		this.messageDao.setClazz(Messages.class);
		return this.messageDao.getEntityAllDesc();
	}
	
	public PageResults<Messages> getMessagesListByPage(){
		this.messageDao.setClazz(Messages.class);
		return this.messageDao.findPageByFetchedHql(1, 10, null);
	}
	
}
